<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListOrderesTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form">
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <h:outputText escape="false" value="#{bundle.ListOrderesEmpty}" rendered="#{orderesController.items.rowCount == 0}"/>
                <h:panelGroup rendered="#{orderesController.items.rowCount > 0}">
                    <h:outputText value="#{orderesController.pagination.pageFirstItem + 1}..#{orderesController.pagination.pageLastItem + 1}/#{orderesController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{orderesController.previous}" value="#{bundle.Previous} #{orderesController.pagination.pageSize}" rendered="#{orderesController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{orderesController.next}" value="#{bundle.Next} #{orderesController.pagination.pageSize}" rendered="#{orderesController.pagination.hasNextPage}"/>&nbsp;
                    <p:dataTable value="#{orderesController.items}" var="item"    style="border:solid 1px">
                        <f:facet name="header">
                            <h2>List</h2> 
                        </f:facet>

                        <f:facet name="footer">
                            <h:outputText value="&nbsp;"/>
                        </f:facet>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListOrderesTitle_ID}"/>
                            </f:facet>
                            <h:outputText value="#{item.ID}"/>
                        </p:column>
                        
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Client"/>
                            </f:facet>
                            <h:outputText value="#{item.client.getName()}"/>    
                        </p:column>
                        

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListOrderesTitle_number}"/>
                            </f:facet>
                            <h:outputText value="#{item.number}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <p:commandButton action="#{orderesController.prepareView}" value="#{bundle.ListOrderesViewLink}"/>
                           
                            <h:outputText value=" "/>
                            <p:commandButton action="#{orderesController.destroy}" value="#{bundle.ListOrderesDestroyLink}"/>
                        </p:column>
                    </p:dataTable>
                </h:panelGroup>
                <br />
               
                <br />
                <h:link outcome="/home" value="#{bundle.ListOrderesIndexLink}"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
